<?php if(is_array($ratings) && !empty($ratings) && $rating_total > 0){?>
<h3><?php echo __d('articles','Rating based on ').' '.$rating_total.' '.__d('articles',' reviews',true)?></h3>

  <style>
  .ui-progressbar { 
	height: .603em;
	width: 82px;
	overflow: hidden;
	text-align: left;
	margin-left: 0px;
	}
	
	.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { 
	border-bottom-right-radius: 2px;
	}
	.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { 
	border-bottom-left-radius: 2px;
	}
	.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { 
	border-top-right-radius: 2px;
	}
	.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { 
	border-top-left-radius: 2px;
	}
  </style>
<div class="rating-list">
		<?php 		
		foreach ($ratings as $key => $r) {?>
		<div class="rating-result">
			<?php
			if(isset($rating_values[$r['Rating']['id']])){?>
			<h4><?php echo $r['Rating']['name']?></h4>
			<div class="rating-results-stars">			
					<input name="data[Rating][<?php echo $key?><?php echo $article_id?>]" type="radio" class="star<?php echo $article_id?>" value="1" title="<?php echo __d('articles','Terrible',true)?>" disabled="disabled" <?php if($rating_values[$r['Rating']['id']]['serd'] == 1){?>checked="checked"<?php }?>/>
					<input name="data[Rating][<?php echo $key?><?php echo $article_id?>]" type="radio" class="star<?php echo $article_id?>" value="2" title="<?php echo __d('articles','Poor',true)?>" disabled="disabled" <?php if($rating_values[$r['Rating']['id']]['serd'] == 2){?>checked="checked"<?php }?>/>
					<input name="data[Rating][<?php echo $key?><?php echo $article_id?>]" type="radio" class="star<?php echo $article_id?>" value="3" title="<?php echo __d('articles','Average',true)?>" disabled="disabled" <?php if($rating_values[$r['Rating']['id']]['serd'] == 3){?>checked="checked"<?php }?>/>
					<input name="data[Rating][<?php echo $key?><?php echo $article_id?>]" type="radio" class="star<?php echo $article_id?>" value="4" title="<?php echo __d('articles','Very Good',true)?>" disabled="disabled" <?php if($rating_values[$r['Rating']['id']]['serd'] == 4){?>checked="checked"<?php }?>/>
					<input name="data[Rating][<?php echo $key?><?php echo $article_id?>]" type="radio" class="star<?php echo $article_id?>" value="5" title="<?php echo __d('articles','Excellent',true)?>" disabled="disabled" <?php if($rating_values[$r['Rating']['id']]['serd'] == 5){?>checked="checked"<?php }?>/>
					&nbsp;&nbsp;
					<?php 
						$opis =  __d('articles','Terrible',true);
						if($rating_values[$r['Rating']['id']]['serd'] >= 1) $opis =  __d('articles','Terrible',true);
						if($rating_values[$r['Rating']['id']]['serd'] >= 2) $opis = __d('articles','Poor',true);
						if($rating_values[$r['Rating']['id']]['serd'] >= 3) $opis = __d('articles','Average',true);
						if($rating_values[$r['Rating']['id']]['serd'] >= 4) $opis = __d('articles','Very Good',true);
						if($rating_values[$r['Rating']['id']]['serd'] >= 4.6) $opis = __d('articles','Excellent',true);
						echo $opis;
					?>
																
			</div>
			<div class='clear'>&nbsp;</div>	
			<div class="progressbar-box">
				<div  style="float: left;" class="progressbar" id="_<?php echo $article_id?>_<?php echo $r['Rating']['id']?>"></div><div style="font-size: 70%; line-height: 1em; ">&nbsp;<?php echo $rating_values[$r['Rating']['id']]['count']?> ( <?php echo __d('articles','reviews')?> )</div>
			</div>
			<script>
			$(function(){
				$(document).ready(function() {
					$("#_<?php echo $article_id?>_<?php echo $r['Rating']['id']?>").progressbar({
						value: <?php echo $rating_values[$r['Rating']['id']]['proc']?> });
				});
			});
			</script>
			<?php }?>
		</div>
		<?php }?>
		<div class="rating-result">
			<h4><?php echo __d('articles','Total')?></h4>
			<div class="rating-results-stars">			
					<input name="data[Rating][<?php echo 'total'?><?php echo $article_id?>]" type="radio" class="star<?php echo $article_id?>" value="1" title="<?php echo __d('articles','Terrible',true)?>" disabled="disabled" <?php if(isset($rating_values['total']['serd']) && $rating_values['total']['serd'] == 1){?>checked="checked"<?php }?>/>
					<input name="data[Rating][<?php echo 'total'?><?php echo $article_id?>]" type="radio" class="star<?php echo $article_id?>" value="2" title="<?php echo __d('articles','Poor',true)?>" disabled="disabled" <?php if(isset($rating_values['total']['serd']) && $rating_values['total']['serd'] == 2){?>checked="checked"<?php }?>/>
					<input name="data[Rating][<?php echo 'total'?><?php echo $article_id?>]" type="radio" class="star<?php echo $article_id?>" value="3" title="<?php echo __d('articles','Average',true)?>" disabled="disabled" <?php if(isset($rating_values['total']['serd']) && $rating_values['total']['serd'] == 3){?>checked="checked"<?php }?>/>
					<input name="data[Rating][<?php echo 'total'?><?php echo $article_id?>]" type="radio" class="star<?php echo $article_id?>" value="4" title="<?php echo __d('articles','Very Good',true)?>" disabled="disabled" <?php if(isset($rating_values['total']['serd']) && $rating_values['total']['serd'] == 4){?>checked="checked"<?php }?>/>
					<input name="data[Rating][<?php echo 'total'?><?php echo $article_id?>]" type="radio" class="star<?php echo $article_id?>" value="5" title="<?php echo __d('articles','Excellent',true)?>" disabled="disabled" <?php if(isset($rating_values['total']['serd']) && $rating_values['total']['serd'] == 5){?>checked="checked"<?php }?>/>
					&nbsp;&nbsp;
					<?php 
						$opis =  __d('articles','Terrible',true);
						if(isset($rating_values['total']['serd']) && $rating_values['total']['serd'] >= 1) $opis =  __d('articles','Terrible',true);
						if(isset($rating_values['total']['serd']) && $rating_values['total']['serd'] >= 2) $opis = __d('articles','Poor',true);
						if(isset($rating_values['total']['serd']) && $rating_values['total']['serd'] >= 3) $opis = __d('articles','Average',true);
						if(isset($rating_values['total']['serd']) && $rating_values['total']['serd'] >= 4) $opis = __d('articles','Very Good',true);
						if(isset($rating_values['total']['serd']) && $rating_values['total']['serd'] >= 4.6) $opis = __d('articles','Excellent',true);
						echo $opis;
					?>
																
			</div>
			<div class='clear'>&nbsp;</div>	
			<div class="progressbar-box">
				<div  style="float: left;" class="progressbar" id="_<?php echo $article_id?>_<?php echo 'total'?>"></div><div style="font-size: 70%; line-height: 1em;">&nbsp;&nbsp;<?php echo $rating_values['total']['count']?> ( <?php echo __d('articles','reviews')?> )</div>
			</div>
			<script>
			$(function(){
				$(document).ready(function() {
					$("#_<?php echo $article_id?>_<?php echo 'total'?>").progressbar({
						value: <?php echo $rating_values['total']['proc']?> });
				});
			});
			</script>
		</div>
</div>
		
				
					
<script>
$(function(){ // wait for document to load
	$('.star<?php echo $article_id?>').rating(); 
	$(document).ready(function() {
	    $("_<?php echo $article_id?>_<?php echo 'total'?>").progressbar({ value: 37 });
	});
});
</script>
<div class='clear'>&nbsp;</div>	
<?php }?>